package cn.edu.neu.vmmigeval.cloud.entity;

public class RandomUtilizationModel implements UtilizationModel{

	
	private double max;
	
	private double min;
	public RandomUtilizationModel() {
		super();
	}

	public RandomUtilizationModel(double min, double max) {
		super();
		this.max = max;
		this.min = min;
	}
	@Override
	public int getUtilization(int total) {

		double rand = 0 ;
		while(true){
			rand = Math.random();
			if(rand>=min&&rand<=max){
				break;
			}
		}
		
		return (int)(total*rand);
	}
	
	public double getMax() {
		return max;
	}
	
	public void setMax(double max) {
		this.max = max;
	}




	public double getMin() {
		return min;
	}




	public void setMin(double min) {
		this.min = min;
	}

	
	
	
	
}
